Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/577 Threshold values for Embeddings #621

Merged
merged 21 commits into from
Dec 7, 2023

Conversation

faisal-alvi
Copy link
Member

Description of the Change

  • This PR adds the threshold setting fields for each taxonomy in the Embeddings settings, allowing users to set the threshold value.
  • The default value is set to 75%.
  • These calculations are based on Threshold value for Embeddings #577 (comment).

Closes #577

How to test the Change

Changelog Entry

Added - Threshold values for Embeddings

Credits

Props @timatron @dkotter @faisal-alvi

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@faisal-alvi faisal-alvi added the type:enhancement New feature or request. label Nov 23, 2023
@faisal-alvi faisal-alvi added this to the 2.6.0 milestone Nov 23, 2023
@faisal-alvi faisal-alvi self-assigned this Nov 23, 2023
includes/Classifai/Providers/Provider.php Outdated Show resolved Hide resolved
includes/Classifai/Providers/OpenAI/Embeddings.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there's some PHPCS warnings that we should look to fix: https://github.com/10up/classifai/actions/runs/6968812438/job/18963465180#step:8:16. Not sure why it's not showing this check as having failed, maybe we only fail on errors and not warnings? But these are easy enough to fix up so ideally we address these

EDIT: looked into this and seems it's due to the 10up-Default ruleset we extend, based on this line: https://github.com/10up/phpcs-composer/blob/master/10up-Default/ruleset.xml#L33

Personally I think we should remove this so we get failures on warnings, otherwise those items never get fixed up.

@faisal-alvi
Copy link
Member Author

@dkotter thanks for the feedback. I've implemented them (and also fixed the minor phpcs warnings). Please check.

Personally I think we should remove this so we get failures on warnings, otherwise those items never get fixed up.

Agree. Should I raise a PR there?

@dkotter dkotter modified the milestones: 2.6.0, 2.5.0 Nov 28, 2023
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In testing, found a few things:

  1. When first going to the settings page, I don't see any default values for the thresholds. After saving the first time, they get set to 75% but those should be set on initial load:
    Default values blank
  2. If the Watson feature is turned off, doesn't seem we load the language-processing.css file, so styles aren't getting loaded:
    Missing styles
  3. Don't think this is a side-effect of this PR (probably due to changes in Enhancement/566 Confirm Classification before Save #609) but no longer seeing the Classify button if the feature is disabled on the post level:

Missing button

@dkotter
Copy link
Collaborator

dkotter commented Nov 28, 2023

Agree. Should I raise a PR there?

Yeah, or just make that change in this PR, either way works for me

@faisal-alvi
Copy link
Member Author

Thanks for the feedback. Changes are implemented.

Don't think this is a side-effect of this PR (probably due to changes in #609) but no longer seeing the Classify button if the feature is disabled on the post level

I have found that this is because the post status is being auto-draft on the first load and the plugin can not find it in the allowed post types list.

image

So as a fix, we can allow auto-draft if someone has allowed the draft type; no need to add a new post type in the settings.

@dkotter
Copy link
Collaborator

dkotter commented Nov 29, 2023

I have found that this is because the post status is being auto-draft on the first load and the plugin can not find it in the allowed post types list.

I was testing with an already published item so I don't think that's the issue I was facing. In looking closer, it seems we have a conditional in our gutenberg-plugin.js file that only loads that button if NLU is enabled. Seems it was set up this way from the beginning and so that button has never shown for the Embeddings feature (which I was mistaken there, I thought I remember it being there but I guess not). I think it would be nice to show that button but that doesn't need to be handled in this PR.

@dkotter dkotter requested a review from berkod November 30, 2023 19:38
@jeffpaul jeffpaul mentioned this pull request Dec 6, 2023
22 tasks
@dkotter dkotter merged commit a45e54a into develop Dec 7, 2023
13 checks passed
@dkotter dkotter deleted the enhancement/embeddings branch December 7, 2023 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Threshold value for Embeddings
3 participants